package com.daisuxia.web.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.daisuxia.back.utils.ServiceResult;
import com.daisuxia.web.pojo.*;
import com.daisuxia.web.pojo.fuyou.MobilePaySend;
import com.daisuxia.web.util.PageConfig;

/**
 *
 */
public interface IRepaymentService {

	/**
	 * 根据条件查找借款
	 * 
	 * @param params
	 * @return
	 */
	public List<Repayment> findAll(HashMap<String, Object> params);

	/**
	 * 根据条件查找一条
	 * 
	 * @param params
	 * @return
	 */
	public Repayment findOneRepayment(Map<String, Object> params);
	public Map<String, Object> findBorrowLoanTerm(Integer borrowId);

	public List<RepaymentDetail> findDetailsByRepId(Integer id);

	public List<Map<String, Object>> findMyLoan(Map<String, Object> params);

	public Repayment selectByPrimaryKey(Integer id);

	public List<Repayment> findParams(Map<String, Object> params);
	/**
	 * 根据主键删除对象
	 * 
	 * @param id
	 */
	public boolean deleteByPrimaryKey(Integer id);

	/**
	 * 插入 对象
	 * 
	 * @param repayment
	 */
	public boolean insert(Repayment repayment);

	/**
	 * 插入 对象
	 *
	 * @param repayment
	 */
	public boolean insertSelective(Repayment repayment);

	/**
	 * 更新 象
	 * 
	 * @param repayment
	 */
	public boolean updateByPrimaryKey(Repayment repayment);


	/**
	 * 更新 象
	 *
	 * @param repayment
	 */
	public boolean updateByPrimaryKeySelective(Repayment repayment);

	/**
	 * 分页查询
	 * 
	 * @param params
	 * @return
	 */
	PageConfig<Repayment> findPage(HashMap<String, Object> params);

	/**
	 * 还款
	 * @param repayment
	 * @param detail
     * @return
     */
	void repay(Repayment repayment, RepaymentDetail detail);

	/**
	 * 代扣
	 * @param re
	 * @param user
     * @return
     */
	ServiceResult withhold(Repayment re, User user, int withholdType, Long money, String debitType);

	/**
	 * 续期
	 * @param repayment
	 * @param rr
	 * @return
	 */
	void renewal(Repayment repayment, RenewalRecord rr);
	  /**
     * 查询还款信息
     * @param borrowId
     * @return
     */
    List<Repayment> findAllByBorrowId(Integer borrowId);

	void updateRenewalByPrimaryKey(Repayment record);

	Repayment collection(User u, Repayment re, RepaymentDetail detail, int collType);

	public Map<String, String> payAction(User user, UserCardInfo info, MobilePaySend paySend, Long money, String act, String orderNo);

	/**
	 * 插入对象
	 * @param borrowOrder
	 * @return
     */
	public boolean insertByBorrorOrder(BorrowOrder borrowOrder);
}
